const { ccclass, property } = cc._decorator;
import WinFormBase from '../WinFormBase';

@ccclass
export default class GradeControl extends cc.Component {
    @property(cc.Node)
    Exp: cc.Node = null;
    @property(cc.Node)
    Ftg: cc.Node = null;
    @property(cc.Node)
    Money: cc.Node = null;
    @property(cc.Node)
    seting: cc.Node = null;
    _Grade: any = null;
    init(Grade: any) {
        this._Grade = Grade;
        this.showExp(Grade.exp);
        this.showFtg(Grade.ftg);
        this.showMoney(Grade.money);
    }
    showExp(exp: number) {
        this.Exp.getChildByName("Label").getComponent(cc.Label).string = exp.toFixed(0);
    }
    showFtg(ftg: number) {
        this.Ftg.getChildByName("Label").getComponent(cc.Label).string = ftg.toFixed(0);
    }
    showMoney(money: number) {
        this.Money.getChildByName("Label").getComponent(cc.Label).string = money.toFixed(0);
    }

    //设置技能背包
    setSeting() {
        let fromNode = new cc.Node();
        let fromControl = fromNode.addComponent(WinFormBase);
        var pageViewEventHandler = new cc.Component.EventHandler();
        pageViewEventHandler.target = this.node;
        pageViewEventHandler.component = "GradeControl"
        pageViewEventHandler.handler = "updateSetLoad";
        fromControl.CloseEvents.push(pageViewEventHandler);
        fromControl.isBgClose = true;
        fromControl.mainNode = this.seting;
        this.node.addChild(fromNode);
    }
    //回调
    updateSetLoad() {

    }
}
